﻿using System.Data;
using System.Collections.Generic;

using SiteUnity.Frame.Common.Tools.Class;
using SiteUnity.Layers.Entity.General;
using SiteUnity.Layers.Entity.PageItems.Files;

namespace SiteUnity.Layers.Core.Provider.PageItems
{
    public class FileProvider:Provider
    {
        public FileProvider()
        {
            SetDefaultConnection();
        }
        public List<FileType> selectFileType()
        {
            Database.clear();
            DataTable datatable = Database.executeQuery("SU_selectFileType");
            Database.close();

            return ClassMapper.ToClassList<FileType>(datatable);
        }

        public List<File> selectFileByPage(Page page)
        {
            Database.clear();
            Database.addParameter("@page_guid", page.Guid);

            DataTable datatable = Database.executeQuery("SU_selectFileByPage");
            Database.close();

            return ClassMapper.ToClassList<File>(datatable);
        }
    }
}
